package br.com.lvc.bicho;

import android.content.Context;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.AnimationUtils;

public class AnimationController {

	public static Animation createAnimationAlphaNormally() {
		Animation animation = new AlphaAnimation(0.0f, 1.0f);
		animation.setDuration(2000);
		animation.setRepeatCount(Animation.INFINITE);
		return animation;
	}
	
	public static Animation createAnimationIncreaseSize(Context context) {
		Animation animation = AnimationUtils.loadAnimation(context, R.anim.aumentar);
		animation.setDuration(3000);
		return animation;
	}
	
	public static Animation createAnimationIncreaseSizeFaster(Context context) {
		Animation animation = AnimationUtils.loadAnimation(context, R.anim.aumentar);
		animation.setDuration(2000);
		return animation;
	}

	public static Animation createAnimationAlpha(Context context) {	
		AnimationSet animationSet = new AnimationSet(false);
		
		Animation desaparecer = new AlphaAnimation(2.0f,0.1f);
		animationSet.addAnimation(configureAnimation(desaparecer));
		
		Animation aparecer = new AlphaAnimation(0.1f,2.0f);
		animationSet.addAnimation(configureAnimation(aparecer));
		
		return animationSet;
	}

	private static Animation configureAnimation(Animation animation) {
		animation.setDuration(3000);
		animation.setFillAfter(false);
		animation.setRepeatCount(Animation.INFINITE);
		return animation;
	}

}
